<%@page import="com.office.automate.model.employee.Employee"%>
<%@page import="com.office.automate.service.impl.employee.EmployeeQueryServiceImplementer"%>
<%@page import="com.office.automate.service.def.employee.EmployeeQueryService"%>
<%@page import="java.util.List"%>
<%@page import="com.office.automate.frontier.utility.DataConversionUtility"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.util.HashMap"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%@ include file="../common/CommonHeaderInfo.jsp"%>
<title>Employee Leave</title>
<script type="text/javascript">
	function onSelectReportType()
	{
	  if (document.getElementById('reportType').value == "summaryDetail"){
		  document.getElementById('employeeid').disabled = true;
	  } else {
		  document.getElementById('employeeid').disabled = false;
	  }
	}
</script>
</head>
<body>
	<%@ include file="../common/SiteHeaderSection.jsp" %>
	<%@ include file="../common/MainMenuBar.jsp"%>
	<%
		if (currentUser == null) {
			return;
		}
		Properties configSeqPropspg = ConfigurationProperties.getProps(); 
		Utility utilpg = new Utility(currentUser.getSecurityLevels());
		if (!utilpg.isFunctionalSecurityAllow(configSeqPropspg.getProperty("MAIN_REPORTING")) ||  
					!utilpg.isFunctionalSecurityAllow(configSeqPropspg.getProperty("REPORT_LEAVE_DETAILS")))  {
			response.sendRedirect("/OfficeAutomation/jsp/HomePage.jsp");
		}	
		DataConversionUtility dataConversionUtility = new DataConversionUtility();
		EmployeeQueryService employeeQueryService = new EmployeeQueryServiceImplementer();
	  	Calendar cal=Calendar.getInstance();
	  	int year=cal.get(Calendar.YEAR);
	%>
	<tr>
		<td>
		<form action="/OfficeAutomation/EmployeeLeaveDetailsReportServlet" method="post">
		<center>
		<table>
			<tr>
				<td colspan="3"><center><font class="formtablecaption"><u>Employee Leave</u></font></center><br /></td>
			</tr>
			<tr>
						
				<td>
				  <center>
 						<table>
							<tr>
								<td width="200px"> Report Type </td>
								<td>
									<select id="reportType" name="reportType" onchange="onSelectReportType()">
										<option value="fullDetail">Full Details</option>
										<option value="summaryDetail">Summary Details</option>
									</select>
								</td>
							</tr>
							<tr>
								<td>Employee Id</td>
								<td><select id="employeeid" name="employeeid">
										<option />
										<%
										List<Employee> list = employeeQueryService.getAllEmployees();
											for (int i=0; i< list.size(); i++) {
												Employee emp = list.get(i);
										%>
											<option value="<%=emp.getEmployeeId() %>" ><%=emp.getEmployeeId() + "-" + emp.getFirstName() %></option>
										<%
											}
										%>
									</select>
								</td>
							</tr>
							<tr>
								<td>From Date </td>
								<td>
								  <select name="fromday">
								  	<%
								  		for (int i=1; i<=31; i++) {
									%>
										<option value="<%=i %>" ><%=i %></option>
									<%
								  		}
								  	%>
								 </select>/
								<select name="frommonth">
										<%

											for (int i=0; i<12; i++) {
										%>
												<option value="<%=i+1 %>" ><%=dataConversionUtility.getMonthDescription(i) %></option>
										<%
											}
										%>
	  							  </select>/
								  <select name="fromyear">
								  	<%
								  		for(int i=1930; i <= year; i++) {
								  	%>
										     <option value="<%=i %>" <% if (i == year) { %> selected="selected"  <% } %>><%=i %></option>
									<%
								  		}
								  	%>
								  </select>
								</td>
							</tr>

							<tr>
								<td>To Date </td>
								<td>
								  <select name="today" >
								  	<%
								  		for (int i=1; i<=31; i++) {
									%>
										<option value="<%=i %>" ><%=i %></option>
									<%
								  		}
								  	%>
								 </select>/
								<select name="tomonth" >
										<%

											for (int i=0; i<12; i++) {
										%>
												<option value="<%=i+1 %>" ><%=dataConversionUtility.getMonthDescription(i) %></option>
										<%
											}
										%>
	  							  </select>/
								  <select name="toyear">
									  	<%
									  		for(int i=1930; i <= year; i++) {
									  	%>
											     <option value="<%=i %>" <% if (i == year) { %> selected="selected"  <% } %>><%=i %></option>
										<%
									  		}
									  	%>
								  </select>
								</td>
							</tr>
						</table>
					</center>
					</td>
				</tr>
				<tr>
					<td colspan="3"><div class="formButtonPanel"><input type="submit" name="submit" value="Submit" /></div></td>
				</tr>
			</table>
		  </center>
		</form>
	  </td>
	</tr>
	<tr>
		<td height="20px">
		
		</td>
	</tr>
<%@ include file="../common/SiteFotterSection.jsp" %>
</body>
</html>